﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Proveedor.aspx.cs" Inherits="ForrajeriaFRONT.ABM.Proveedor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 134px;
        }
        .style2
        {
            width: 136px;
        }
        .style3
        {
            width: 137px;
        }
        .style4
        {
            width: 139px;
        }
        .style5
        {
            width: 165px;
        }
        .style8
        {
            width: 372px;
        }
        .style9
        {
            width: 100%;
        }
        .style10
        {
            width: 108px;
        }
    .style11
    {
        width: 134px;
        color: #000000;
    }
    .style12
    {
        color: #000000;
    }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="panelCarga" runat="server" CssClass="style12">
    <asp:ValidationSummary ID="valSumary" runat="server" ForeColor="Red" 
            ValidationGroup="gGuardar" />

    <table id="tablaDatos" cellpadding="5" cellspacing="5" runat="server">
           <tbody>
            <tr>
                <td colspan="2"><b>Datos Cliente:</b></td>
                <td>
                    &nbsp;</td>
                <td colspan="2"><b>Datos Domicilio:</b></td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style11">
                    <asp:Label ID="lblRazonSocial" runat="server" Text="Razón social" />
                </td>
                <td class="style3"><asp:TextBox ID="txtRazonSocial" runat="server" Text="" 
                        MaxLength="50" Width="150px"></asp:TextBox>
                </td>
                <td class="style3">
                    
                    
                    <asp:RequiredFieldValidator ID="reqRazonSocial" runat="server" 
                        ControlToValidate="txtRazonSocial" Display="None" 
                        ErrorMessage="Debe ingresar una razón social" ForeColor="Red" Text="*" 
                        ValidationGroup="gGuardar"></asp:RequiredFieldValidator>
                    
                    
                </td>
                <td class="style4">
                    <asp:Label ID="lblProvincia" runat="server" Text="Provincia" Width="130px" />
                </td>
                <td class="style2">
                    
                                
                                
                            
                           
                    <asp:DropDownList ID="ddlProvincia" runat="server" AutoPostBack="True" 
                        onselectedindexchanged="ddlProvincia_SelectedIndexChanged" 
                        UpdateMode="Conditional" Width="150px">
                    </asp:DropDownList>
                    
                                
                                
                            
                           
                </td>
                <td class="style2">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style11">
                    <asp:Label ID="lblCuitCuil" runat="server" Text="CUIT o CUIL" />
                </td>
                <td class="style3"><asp:TextBox ID="txtCuit" runat="server" Text="" MaxLength="50" 
                        Width="150px"></asp:TextBox>
                </td>
                <td class="style3">
                    
                    
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                        ControlToValidate="txtCuit" ErrorMessage="Debe Ingresar un CUIT/CUIL Valido" 
                        ForeColor="Red" ValidationExpression="^[0-9]{2}-[0-9]{8}-[0-9]$" 
                        ValidationGroup="gGuardar">*</asp:RegularExpressionValidator>
                    
                    
                </td>
                <td class="style4">Localidad:</td>
                <td class="style2">
                   
                                
                                
                            
                           
                    <asp:DropDownList ID="ddlLocalidad" runat="server" Enabled="False" 
                        Width="150px">
                    </asp:DropDownList>
                   
                                
                                
                            
                           
                </td>
                <td class="style2">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style11">
                    <asp:Label ID="lblMail" runat="server" Text="E-Mail" />
                </td>
                <td class="style3">
                    <asp:TextBox ID="txtMail" runat="server"></asp:TextBox>
                </td>
                <td class="style3">
                    
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="txtMail" ErrorMessage="Debe Ingresar un Email Valido" 
                        ForeColor="Red" 
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
                    
                </td>
                <td class="style4">
                    <asp:Label ID="lblCalle" runat="server" Text="Calle" />
                </td>
                <td class="style2">
                    <asp:TextBox ID="txtCalle" runat="server" CssClass="texto" MaxLength="50" 
                        Width="90%" />
                    
                </td>
                <td class="style2">
                    <asp:RequiredFieldValidator ID="rfvCalle" runat="server" 
                        ControlToValidate="txtCalle" Display="None" ErrorMessage="Falta Ingresar Calle" 
                        ForeColor="Red" ValidationGroup="gGuardar">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style11">
                    <asp:Label ID="lblTelefono" runat="server" Text="Teléfono" />
                </td>
                <td class="style2">
                    <asp:TextBox ID="txtTelefono" runat="server" CssClass="texto" MaxLength="50" 
                        Width="90%" />
                </td>
                <td class="style2">
                    
                    
                </td>
                <td class="style4">Numero:</td>
                <td class="style2"><asp:TextBox ID="txtNumeroCalle" runat="server" Text="" MaxLength="10" Width="150px"></asp:TextBox>
                </td>
                <td class="style2">
                    <asp:RequiredFieldValidator ID="rfvNumeroCalle" runat="server" 
                        ControlToValidate="txtNumeroCalle" Display="None" 
                        ErrorMessage="Falta Ingresar Numero de Calle" ForeColor="Red" 
                        ValidationGroup="gGuardar">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style11">&nbsp;</td>
                <td class="style3">
                    <asp:Label ID="lblCodigoProveedor" runat="server" Visible="False"></asp:Label>
                </td>
                <td class="style3">
                    
                </td>
                <td class="style4">
                    <asp:Label ID="lblPiso" runat="server" Text="Piso" />
                </td>
                <td><asp:TextBox ID="txtPiso" runat="server" Text="" MaxLength="2" Width="150px"></asp:TextBox>
                </td>            
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style1"></td>
                <td class="style3"></td>
                <td class="style3">
                    &nbsp;</td>
                <td class="style4">Departamento:</td>
                <td><asp:TextBox ID="txtDepartamento" runat="server" Text="" MaxLength="2" Width="150px"></asp:TextBox></td>
                
                <td>
                    &nbsp;</td>
                
            </tr>
        </tbody>
        </table>
    
     <div id="botones" class="botones">
        <table  cellspacing="10">
     <tbody>
     <tr>
     <td>
     <asp:Button ID="btnVolver" Text="Volver" runat="server"
             CausesValidation="false" onclick="btnVolver_Click"  
              />
     </td>
     
     
     <td class="style48">
     <asp:Button ID="btnLimpiar" Text="Limpiar" runat="server"
             CausesValidation="false" ToolTip="Limpia Formulario" 
             onclick="btnLimpiar_Click" />
     </td>
     <td>
     <asp:Button ID="btnGuardar" Text="Guardar" runat="server" Height="26px" 
             onclick="btnGuardar_Click" CausesValidation="true" ValidationGroup="gGuardar"
             />
     </td>
     <td class="style4">
         <asp:Button ID="Button2" runat="server" CausesValidation="false" 
             onclick="btnRegForrajes_Click" style="margin-left: 0px; height: 26px;" 
             Text="Registrar Forrajes" 
             ToolTip="Registra los forrajes de este proveedor" />
         </td>
     <td>
         &nbsp;</td>
     </tr>
     </tbody>
     </table>
    </div>





    </asp:Panel>
    <asp:Panel ID="panelBusca" runat="server" CssClass="style12">


  <div>
            <table class="style2">
                <tr>
                    <td class="style8">
                        <asp:Label ID="lblNuevoProveedor" runat="server" Text="Registrar Nuevo Proveedor" 
                            Font-Bold="True"></asp:Label>
                    </td>
                    <td class="style5">
                        <asp:Button ID="Button1" runat="server" CausesValidation="false" 
                             style="margin-left: 0px; height: 26px;" Text="Nuevo" 
                            onclick="btnNuevo_Click"  />
                    </td>
                </tr>
                <tr>
                    <td class="style8">
                        &nbsp;</td>
                        <td class="style5">
                            &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style8">
                        &nbsp;</td>
                    <td class="style5">
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" 
                            ValidationGroup="gBuscar" />
                    </td>
                    <td>
                        <asp:Label ID="mensaje" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="style8">
                        <asp:Label ID="lblBuscar" runat="server" Text="Buscar Proveedor" 
                            Font-Bold="True"></asp:Label>
                    </td>
                    <td class="style5">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style8">
                        <asp:Label ID="lblRazonSocial2" runat="server" Text=" Razon Social"></asp:Label>
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="txtRazonSocial2" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style8">
                        <asp:Label ID="lblCuit2" runat="server" Text="CUIT o CUIL"></asp:Label>
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="txtCuit2" runat="server"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                            ControlToValidate="txtCuit2" ErrorMessage="Ingrese un CUIT/CUIL Valido" 
                            ForeColor="Red" ValidationExpression="^[0-9]{2}-[0-9]{8}-[0-9]$" 
                            ValidationGroup="gBuscar">*</asp:RegularExpressionValidator>
                    </td>
                </tr>
                <tr>
                    <td class="style8">
                        <asp:Label ID="lblTelefono2" runat="server" Text="Telefono:"></asp:Label>
                    </td>
                    <td class="style5">
                        <asp:TextBox ID="txtTelefono2" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style8">
                        &nbsp;</td>
                    <td class="style5">
                        <asp:Button ID="btnBuscar2" runat="server" Text="Buscar" 
                            onclick="btnBuscar2_Click" />
                    </td>
                </tr>
            </table>

        <asp:GridView ID="gvProveedor" runat="server" AutoGenerateColumns="False" 
                CellPadding="4" ForeColor="#333333" GridLines="None" 
                onrowdeleting="gvProveedor_RowDeleting" 
                onselectedindexchanging="gvProveedor_SelectedIndexChanging" 
                DataKeyNames="CodigoProveedor,Mail,Calle,Nro,Piso,Dpto,Id_Localidad" 
                EmptyDataText="No hay Datos para Mostrar">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="RazonSocial" HeaderText="Razon Social" />
                <asp:BoundField DataField="CuitCuil" HeaderText="Cuit/Cuil" />
                <asp:BoundField DataField="Telefono" HeaderText="Telefono" />
                <asp:CommandField ButtonType="Image" HeaderText="Editar" 
                    SelectImageUrl="~/Images/modificarABM.jpg" ShowSelectButton="True" />
                <asp:CommandField ButtonType="Image" DeleteImageUrl="~/Images/borrarABM.jpg" 
                    HeaderText="Quitar" ShowDeleteButton="True" />
            </Columns>
            <EditRowStyle BackColor="#7C6F57" />
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F8FAFA" />
            <SortedAscendingHeaderStyle BackColor="#246B61" />
            <SortedDescendingCellStyle BackColor="#D4DFE1" />
            <SortedDescendingHeaderStyle BackColor="#15524A" />
        </asp:GridView>
        </div>
    </asp:Panel>

        <asp:Panel ID="panelForraje" runat="server" CssClass="style12">
        <h3>
        <asp:Label ID="lblForrajeProv" runat="server" Text="Forrajes del Proveedor"></asp:Label></h3>
    <table class="style9">
        <tr>
            <td class="style10">
                <asp:Label ID="lblProv" runat="server" Text="Proveedor:"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtProv" runat="server" Enabled="False"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style10">
                <asp:Label ID="lblForraje" runat="server" Text="Forraje:"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddlForraje" runat="server" Width="125px">
                </asp:DropDownList>
            </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style10">
                <asp:Label ID="lblPrecioPXF" runat="server" Text="Precio:"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtPrecioPXF" runat="server"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style10">
                &nbsp;</td>
            <td>
                <asp:Button ID="btnAgregaPXF" runat="server" onclick="btnAgregaPXF_Click" 
                    Text="Agregar" />
            </td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
<asp:GridView ID="gvProvXForraje" runat="server" AutoGenerateColumns="False" 
                CellPadding="4" 
                DataKeyNames="CodigoProveedor,Mail,Calle,Nro,Piso,Dpto,Id_Localidad" 
                EmptyDataText="No hay Datos para Mostrar" ForeColor="#333333" GridLines="None" 
                onrowdeleting="gvProvXForraje_RowDeleting" 
                onselectedindexchanging="gvProvXForraje_SelectedIndexChanging">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="RazonSocial" HeaderText="Forraje" />
                <asp:BoundField DataField="CuitCuil" HeaderText="Precio" />
                <asp:CommandField ButtonType="Image" HeaderText="Editar" 
                    SelectImageUrl="~/Images/modificarABM.jpg" ShowSelectButton="True" />
                <asp:CommandField ButtonType="Image" DeleteImageUrl="~/Images/borrarABM.jpg" 
                    HeaderText="Quitar" ShowDeleteButton="True" />
            </Columns>
            <EditRowStyle BackColor="#7C6F57" />
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F8FAFA" />
            <SortedAscendingHeaderStyle BackColor="#246B61" />
            <SortedDescendingCellStyle BackColor="#D4DFE1" />
            <SortedDescendingHeaderStyle BackColor="#15524A" />
            </asp:GridView>
            
    </asp:Panel>
</asp:Content>
